Background

How has COVID-19 affected mobility of people and goods across the globe?

We are interested in the pandemic’s effects on society. The dataset discusses how goods have moved and how people have travelled given all these different restrictions.

We have seen how different measures from country to country, state to state, district to district have altered the free movement of people and goods. The presumptive goal of every single measure was to lower the confirmed cases and deaths in the given region that are due to the virus. With so many different and disparate approaches, it’s difficult to see what measures correlated with what behavior. We decided to compare two regions, similar in geographic location, population size, culture, and history: Sweden and Denmark. Their mobility behavior and COVID-19 statistics are reflected in the two data sets: covid19_ecdc.covid_19_geographic_distribution_worldwide and covid19_google_mobility.mobility_report.

We chose these regions because the approach to mitigating the effects of COVID-19 in terms of mobility and the resultant economic and health implications were considerably different. While both effectively closed their borders, mobility was severely curtailed in Denmark (lockdown) whereas Sweden only issued recommendations (non-mandatory). These are contrasting responses for geographies that are physically connected and whose populations are virtually homogeneous to each other.

An important consideration for these datasets is to treat time itself as a variable. There are many ways to treat time, and in this analysis we considered time in terms of before-and- after. Moreover, incorporating time gives us causal leverage. We want to see how behavior changed after some particular event takes place. We explored how COVID-19 influenced mobility instrumentally through border closures. And specifically, we considered COVID-19 metrics (cases and deaths per million) before and after border closures - since this was a measure taken by most countries and severely restricted mobility of people and goods across the globe. We employ a before-and-after modeling technique in time series analysis called difference-in-differences, or a pretest-posttest with comparison group. For this to be a valid method, all we must assume is the equal change or parallel trends - reflected in our choice of Sweden and Denmark.

Lastly, in order to incorporate uncertainty, we performed Bayesian modeling calling Stan in R. This gives us a posterior distribution for our estimates, rather than single point estimates, and credibility intervals that allows us to make a probability statement about our estimates given the observed data.

Time series models are very sensitive to missingness so check our data for missing measurements.

# visualize NAs
vis_miss(mobility, warn_large_data =  F)

The data seems to have been collected sparsely for some variables on some days, so we will aggregate into weeks and months. The jitter from day to day is likeley to be too granular for this model anyway.


Data Exploration

After Border Closures

Recall, Denmark closed its border on March 14, 2020. Meanwhile, Sweden closes its borders to non-EU member states on March 19, 2020, and virtually all EU countries imposed travel restrictions at about the same time effectively prohibiting all travel into Sweden. The result is equivalent to a closed border. Both are closed within a week of each other, and we treat these as roughly equivalent for our analysis purposes.


Change in Mobility



Changes in Mobility Over Time by Month

grid.arrange(a, b, c, d, e, nrow = 5)



Changes in Mobility Over Time by Week

grid.arrange(f, g, h, i, j, nrow = 5)



Change in COVID Metrics


Monthly Averages of COVID-19 Statistics

grid.arrange(l, n, o, nrow = 3)


Weekly Averages of COVID-19 Statistics

grid.arrange(q, s, t, nrow = 3)


Difference in Differences

What is the effect of a mobility related policy on COVID related metrics?

A difference in differences model compares COVID related metrics before-and-after border closure for Sweden to the before-and-after border closure for Denmark. For two countries that can be considered quite easily the same country, we would expect the closure of borders to have comparable effects on COVID metrics.

In Conditional Mean Terms

Observing only differences in means daily confirmed cases per million between Sweden and Denmark, there is an increase of an additional 32 cases for Sweden as compared to Denmark.

Country Change in Daily Confirmed Cases per Million
Sweden Increase of 4 to 47 daily confirmed cases per million
Denmark Increase of 6 to 17 daily confirmed cases per million

Observing only differences in means daily deaths per million between Sweden and Denmark, there is an increase of an additional 2 cases for Sweden as compared to Denmark.

Country Change in Daily Deaths per Million
Sweden Increase from 0 to 3 daily deaths per million
Denmark Increase from 0 to 1 daily deaths per million

In Regression Terms

Daily Cases per Million


SAMPLING FOR MODEL 'continuous' NOW (CHAIN 1).
Chain 1: 
Chain 1: Gradient evaluation took 0.000574 seconds
Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 5.74 seconds.
Chain 1: Adjust your expectations accordingly!
Chain 1: 
Chain 1: 
Chain 1: Iteration:    1 / 2000 [  0%]  (Warmup)
Chain 1: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 1: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 1: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 1: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 1: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 1: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 1: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 1: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 1: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 1: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 1: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 1: 
Chain 1:  Elapsed Time: 0.063096 seconds (Warm-up)
Chain 1:                4.82119 seconds (Sampling)
Chain 1:                4.88428 seconds (Total)
Chain 1: 

SAMPLING FOR MODEL 'continuous' NOW (CHAIN 2).
Chain 2: 
Chain 2: Gradient evaluation took 2e-05 seconds
Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 0.2 seconds.
Chain 2: Adjust your expectations accordingly!
Chain 2: 
Chain 2: 
Chain 2: Iteration:    1 / 2000 [  0%]  (Warmup)
Chain 2: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 2: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 2: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 2: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 2: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 2: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 2: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 2: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 2: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 2: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 2: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 2: 
Chain 2:  Elapsed Time: 0.071376 seconds (Warm-up)
Chain 2:                4.78178 seconds (Sampling)
Chain 2:                4.85316 seconds (Total)
Chain 2: 

SAMPLING FOR MODEL 'continuous' NOW (CHAIN 3).
Chain 3: 
Chain 3: Gradient evaluation took 1.8e-05 seconds
Chain 3: 1000 transitions using 10 leapfrog steps per transition would take 0.18 seconds.
Chain 3: Adjust your expectations accordingly!
Chain 3: 
Chain 3: 
Chain 3: Iteration:    1 / 2000 [  0%]  (Warmup)
Chain 3: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 3: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 3: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 3: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 3: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 3: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 3: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 3: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 3: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 3: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 3: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 3: 
Chain 3:  Elapsed Time: 0.078339 seconds (Warm-up)
Chain 3:                4.77022 seconds (Sampling)
Chain 3:                4.84856 seconds (Total)
Chain 3: 

SAMPLING FOR MODEL 'continuous' NOW (CHAIN 4).
Chain 4: 
Chain 4: Gradient evaluation took 1.8e-05 seconds
Chain 4: 1000 transitions using 10 leapfrog steps per transition would take 0.18 seconds.
Chain 4: Adjust your expectations accordingly!
Chain 4: 
Chain 4: 
Chain 4: Iteration:    1 / 2000 [  0%]  (Warmup)
Chain 4: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 4: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 4: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 4: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 4: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 4: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 4: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 4: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 4: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 4: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 4: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 4: 
Chain 4:  Elapsed Time: 0.079583 seconds (Warm-up)
Chain 4:                4.7905 seconds (Sampling)
Chain 4:                4.87009 seconds (Total)
Chain 4: 

Model Info:
 function:     stan_glm
 family:       gaussian [identity]
 formula:      daily_confirmed_cases_per_mil ~ factor(closed) + factor(country)
 algorithm:    sampling
 sample:       4000 (posterior sample size)
 priors:       see help('prior_summary')
 observations: 68976
 predictors:   3

Estimates:
                        mean   sd    10%   50%   90%
(Intercept)           -12.4    0.3 -12.8 -12.4 -12.0
factor(closed)1        33.3    0.3  33.0  33.3  33.7
factor(country)Sweden  24.7    0.2  24.4  24.7  24.9
sigma                  27.3    0.1  27.2  27.3  27.4

Fit Diagnostics:
           mean   sd   10%   50%   90%
mean_PPD 33.4    0.1 33.2  33.4  33.6 

The mean_ppd is the sample average posterior predictive distribution of the outcome variable (for details see help('summary.stanreg')).

MCMC diagnostics
                      mcse Rhat n_eff
(Intercept)           0.0  1.0  4667 
factor(closed)1       0.0  1.0  4528 
factor(country)Sweden 0.0  1.0  5520 
sigma                 0.0  1.0  6149 
mean_PPD              0.0  1.0  3412 
log-posterior         0.0  1.0  1571 

For each parameter, mcse is Monte Carlo standard error, n_eff is a crude measure of effective sample size, and Rhat is the potential scale reduction factor on split chains (at convergence Rhat=1).

SAMPLING FOR MODEL 'continuous' NOW (CHAIN 1).
Chain 1: 
Chain 1: Gradient evaluation took 2.9e-05 seconds
Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 0.29 seconds.
Chain 1: Adjust your expectations accordingly!
Chain 1: 
Chain 1: 
Chain 1: Iteration:    1 / 2000 [  0%]  (Warmup)
Chain 1: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 1: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 1: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 1: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 1: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 1: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 1: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 1: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 1: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 1: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 1: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 1: 
Chain 1:  Elapsed Time: 0.11269 seconds (Warm-up)
Chain 1:                2.34239 seconds (Sampling)
Chain 1:                2.45508 seconds (Total)
Chain 1: 

SAMPLING FOR MODEL 'continuous' NOW (CHAIN 2).
Chain 2: 
Chain 2: Gradient evaluation took 1.8e-05 seconds
Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 0.18 seconds.
Chain 2: Adjust your expectations accordingly!
Chain 2: 
Chain 2: 
Chain 2: Iteration:    1 / 2000 [  0%]  (Warmup)
Chain 2: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 2: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 2: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 2: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 2: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 2: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 2: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 2: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 2: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 2: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 2: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 2: 
Chain 2:  Elapsed Time: 0.129337 seconds (Warm-up)
Chain 2:                2.35135 seconds (Sampling)
Chain 2:                2.48069 seconds (Total)
Chain 2: 

SAMPLING FOR MODEL 'continuous' NOW (CHAIN 3).
Chain 3: 
Chain 3: Gradient evaluation took 1.9e-05 seconds
Chain 3: 1000 transitions using 10 leapfrog steps per transition would take 0.19 seconds.
Chain 3: Adjust your expectations accordingly!
Chain 3: 
Chain 3: 
Chain 3: Iteration:    1 / 2000 [  0%]  (Warmup)
Chain 3: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 3: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 3: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 3: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 3: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 3: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 3: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 3: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 3: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 3: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 3: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 3: 
Chain 3:  Elapsed Time: 0.380066 seconds (Warm-up)
Chain 3:                2.34811 seconds (Sampling)
Chain 3:                2.72817 seconds (Total)
Chain 3: 

SAMPLING FOR MODEL 'continuous' NOW (CHAIN 4).
Chain 4: 
Chain 4: Gradient evaluation took 1.8e-05 seconds
Chain 4: 1000 transitions using 10 leapfrog steps per transition would take 0.18 seconds.
Chain 4: Adjust your expectations accordingly!
Chain 4: 
Chain 4: 
Chain 4: Iteration:    1 / 2000 [  0%]  (Warmup)
Chain 4: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 4: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 4: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 4: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 4: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 4: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 4: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 4: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 4: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 4: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 4: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 4: 
Chain 4:  Elapsed Time: 0.123187 seconds (Warm-up)
Chain 4:                2.34314 seconds (Sampling)
Chain 4:                2.46633 seconds (Total)
Chain 4: 

Model Info:
 function:     stan_glm
 family:       gaussian [identity]
 formula:      daily_confirmed_cases_per_mil ~ factor(closed) + factor(country) + 
       retail_rec * grocery_pharm
 algorithm:    sampling
 sample:       4000 (posterior sample size)
 priors:       see help('prior_summary')
 observations: 32567
 predictors:   6

Estimates:
                           mean   sd    10%   50%   90%
(Intercept)              -10.1    0.4 -10.5 -10.1  -9.6
factor(closed)1           31.4    0.4  30.9  31.4  31.9
factor(country)Sweden     23.5    0.3  23.2  23.5  23.9
retail_rec                -0.3    0.0  -0.3  -0.3  -0.3
grocery_pharm              0.3    0.0   0.3   0.3   0.3
retail_rec:grocery_pharm   0.0    0.0   0.0   0.0   0.0
sigma                     25.1    0.1  25.0  25.1  25.2

Fit Diagnostics:
           mean   sd   10%   50%   90%
mean_PPD 31.0    0.2 30.7  31.0  31.2 

The mean_ppd is the sample average posterior predictive distribution of the outcome variable (for details see help('summary.stanreg')).

MCMC diagnostics
                         mcse Rhat n_eff
(Intercept)              0.0  1.0  3607 
factor(closed)1          0.0  1.0  3330 
factor(country)Sweden    0.0  1.0  3984 
retail_rec               0.0  1.0  4035 
grocery_pharm            0.0  1.0  4265 
retail_rec:grocery_pharm 0.0  1.0  5064 
sigma                    0.0  1.0  3183 
mean_PPD                 0.0  1.0  3508 
log-posterior            0.0  1.0  1797 

For each parameter, mcse is Monte Carlo standard error, n_eff is a crude measure of effective sample size, and Rhat is the potential scale reduction factor on split chains (at convergence Rhat=1).
                                    5%          95%
(Intercept)              -10.658908926 -9.445103999
factor(closed)1           30.814541613 32.015035477
factor(country)Sweden     23.049870179 24.008658751
retail_rec                -0.279233430 -0.253523321
grocery_pharm              0.279411970  0.323936713
retail_rec:grocery_pharm   0.001927921  0.002557824
sigma                     24.961860417 25.288804931
summary(reg1)

Model Info:
 function:     stan_glm
 family:       gaussian [identity]
 formula:      daily_confirmed_cases_per_mil ~ factor(closed) + factor(country)
 algorithm:    sampling
 sample:       4000 (posterior sample size)
 priors:       see help('prior_summary')
 observations: 68976
 predictors:   3

Estimates:
                        mean   sd    10%   50%   90%
(Intercept)           -12.4    0.3 -12.8 -12.4 -12.0
factor(closed)1        33.3    0.3  33.0  33.3  33.7
factor(country)Sweden  24.7    0.2  24.4  24.7  24.9
sigma                  27.3    0.1  27.2  27.3  27.4

Fit Diagnostics:
           mean   sd   10%   50%   90%
mean_PPD 33.4    0.1 33.2  33.4  33.6 

The mean_ppd is the sample average posterior predictive distribution of the outcome variable (for details see help('summary.stanreg')).

MCMC diagnostics
                      mcse Rhat n_eff
(Intercept)           0.0  1.0  4667 
factor(closed)1       0.0  1.0  4528 
factor(country)Sweden 0.0  1.0  5520 
sigma                 0.0  1.0  6149 
mean_PPD              0.0  1.0  3412 
log-posterior         0.0  1.0  1571 

For each parameter, mcse is Monte Carlo standard error, n_eff is a crude measure of effective sample size, and Rhat is the potential scale reduction factor on split chains (at convergence Rhat=1).
summary(reg2)

Model Info:
 function:     stan_glm
 family:       gaussian [identity]
 formula:      daily_confirmed_cases_per_mil ~ factor(closed) + factor(country) + 
       retail_rec * grocery_pharm
 algorithm:    sampling
 sample:       4000 (posterior sample size)
 priors:       see help('prior_summary')
 observations: 32567
 predictors:   6

Estimates:
                           mean   sd    10%   50%   90%
(Intercept)              -10.1    0.4 -10.5 -10.1  -9.6
factor(closed)1           31.4    0.4  30.9  31.4  31.9
factor(country)Sweden     23.5    0.3  23.2  23.5  23.9
retail_rec                -0.3    0.0  -0.3  -0.3  -0.3
grocery_pharm              0.3    0.0   0.3   0.3   0.3
retail_rec:grocery_pharm   0.0    0.0   0.0   0.0   0.0
sigma                     25.1    0.1  25.0  25.1  25.2

Fit Diagnostics:
           mean   sd   10%   50%   90%
mean_PPD 31.0    0.2 30.7  31.0  31.2 

The mean_ppd is the sample average posterior predictive distribution of the outcome variable (for details see help('summary.stanreg')).

MCMC diagnostics
                         mcse Rhat n_eff
(Intercept)              0.0  1.0  3607 
factor(closed)1          0.0  1.0  3330 
factor(country)Sweden    0.0  1.0  3984 
retail_rec               0.0  1.0  4035 
grocery_pharm            0.0  1.0  4265 
retail_rec:grocery_pharm 0.0  1.0  5064 
sigma                    0.0  1.0  3183 
mean_PPD                 0.0  1.0  3508 
log-posterior            0.0  1.0  1797 

For each parameter, mcse is Monte Carlo standard error, n_eff is a crude measure of effective sample size, and Rhat is the potential scale reduction factor on split chains (at convergence Rhat=1).
posterior_interval(reg2, prog = .9, type = 'central', pars = NULL, regex_pars = NULL)
                                    5%          95%
(Intercept)              -10.658908926 -9.445103999
factor(closed)1           30.814541613 32.015035477
factor(country)Sweden     23.049870179 24.008658751
retail_rec                -0.279233430 -0.253523321
grocery_pharm              0.279411970  0.323936713
retail_rec:grocery_pharm   0.001927921  0.002557824
sigma                     24.961860417 25.288804931

There is an increase of about 32*** daily confirmed cases per million after border closure. In Sweden alone, net of other measures, there was an increase of roughly 23 daily confirmed cases per million. Net of country and other measures, restriction of mobility for retail/recreation and grocery/pharmacy establishments (interaction term) does not appear to decrease the daily confirmed cases per million. Interestingly, restriction on mobility for retail/recreation appears to decrease daily confirmed cases net of other measures, but restricting grocery/pharmacy mobility does not. Both of these measures are close to zero, however. These statistics are all significant at the 99.9% confidence level. The overall model explains only 33% of the variance in the observed confirmed daily cases per million.

Daily Deaths per Million


SAMPLING FOR MODEL 'continuous' NOW (CHAIN 1).
Chain 1: 
Chain 1: Gradient evaluation took 1.8e-05 seconds
Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 0.18 seconds.
Chain 1: Adjust your expectations accordingly!
Chain 1: 
Chain 1: 
Chain 1: Iteration:    1 / 2000 [  0%]  (Warmup)
Chain 1: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 1: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 1: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 1: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 1: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 1: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 1: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 1: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 1: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 1: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 1: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 1: 
Chain 1:  Elapsed Time: 0.052546 seconds (Warm-up)
Chain 1:                4.80563 seconds (Sampling)
Chain 1:                4.85818 seconds (Total)
Chain 1: 

SAMPLING FOR MODEL 'continuous' NOW (CHAIN 2).
Chain 2: 
Chain 2: Gradient evaluation took 1.5e-05 seconds
Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 0.15 seconds.
Chain 2: Adjust your expectations accordingly!
Chain 2: 
Chain 2: 
Chain 2: Iteration:    1 / 2000 [  0%]  (Warmup)
Chain 2: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 2: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 2: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 2: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 2: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 2: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 2: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 2: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 2: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 2: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 2: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 2: 
Chain 2:  Elapsed Time: 0.050151 seconds (Warm-up)
Chain 2:                4.78711 seconds (Sampling)
Chain 2:                4.83726 seconds (Total)
Chain 2: 

SAMPLING FOR MODEL 'continuous' NOW (CHAIN 3).
Chain 3: 
Chain 3: Gradient evaluation took 1.5e-05 seconds
Chain 3: 1000 transitions using 10 leapfrog steps per transition would take 0.15 seconds.
Chain 3: Adjust your expectations accordingly!
Chain 3: 
Chain 3: 
Chain 3: Iteration:    1 / 2000 [  0%]  (Warmup)
Chain 3: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 3: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 3: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 3: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 3: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 3: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 3: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 3: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 3: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 3: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 3: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 3: 
Chain 3:  Elapsed Time: 0.052898 seconds (Warm-up)
Chain 3:                4.7771 seconds (Sampling)
Chain 3:                4.83 seconds (Total)
Chain 3: 

SAMPLING FOR MODEL 'continuous' NOW (CHAIN 4).
Chain 4: 
Chain 4: Gradient evaluation took 2e-05 seconds
Chain 4: 1000 transitions using 10 leapfrog steps per transition would take 0.2 seconds.
Chain 4: Adjust your expectations accordingly!
Chain 4: 
Chain 4: 
Chain 4: Iteration:    1 / 2000 [  0%]  (Warmup)
Chain 4: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 4: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 4: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 4: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 4: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 4: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 4: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 4: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 4: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 4: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 4: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 4: 
Chain 4:  Elapsed Time: 0.051245 seconds (Warm-up)
Chain 4:                4.78675 seconds (Sampling)
Chain 4:                4.83799 seconds (Total)
Chain 4: 

Model Info:
 function:     stan_glm
 family:       gaussian [identity]
 formula:      daily_deaths_per_mil ~ factor(closed) + factor(country)
 algorithm:    sampling
 sample:       4000 (posterior sample size)
 priors:       see help('prior_summary')
 observations: 68976
 predictors:   3

Estimates:
                        mean   sd   10%   50%   90%
(Intercept)           -1.4    0.0 -1.5  -1.4  -1.4 
factor(closed)1        2.3    0.0  2.3   2.3   2.3 
factor(country)Sweden  2.1    0.0  2.1   2.1   2.1 
sigma                  2.4    0.0  2.4   2.4   2.4 

Fit Diagnostics:
           mean   sd   10%   50%   90%
mean_PPD 2.0    0.0  2.0   2.0   2.0  

The mean_ppd is the sample average posterior predictive distribution of the outcome variable (for details see help('summary.stanreg')).

MCMC diagnostics
                      mcse Rhat n_eff
(Intercept)           0.0  1.0  3986 
factor(closed)1       0.0  1.0  4276 
factor(country)Sweden 0.0  1.0  4624 
sigma                 0.0  1.0  5744 
mean_PPD              0.0  1.0  3253 
log-posterior         0.0  1.0  1875 

For each parameter, mcse is Monte Carlo standard error, n_eff is a crude measure of effective sample size, and Rhat is the potential scale reduction factor on split chains (at convergence Rhat=1).

SAMPLING FOR MODEL 'continuous' NOW (CHAIN 1).
Chain 1: 
Chain 1: Gradient evaluation took 1.8e-05 seconds
Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 0.18 seconds.
Chain 1: Adjust your expectations accordingly!
Chain 1: 
Chain 1: 
Chain 1: Iteration:    1 / 2000 [  0%]  (Warmup)
Chain 1: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 1: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 1: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 1: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 1: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 1: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 1: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 1: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 1: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 1: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 1: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 1: 
Chain 1:  Elapsed Time: 0.096389 seconds (Warm-up)
Chain 1:                2.38944 seconds (Sampling)
Chain 1:                2.48582 seconds (Total)
Chain 1: 

SAMPLING FOR MODEL 'continuous' NOW (CHAIN 2).
Chain 2: 
Chain 2: Gradient evaluation took 1.9e-05 seconds
Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 0.19 seconds.
Chain 2: Adjust your expectations accordingly!
Chain 2: 
Chain 2: 
Chain 2: Iteration:    1 / 2000 [  0%]  (Warmup)
Chain 2: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 2: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 2: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 2: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 2: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 2: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 2: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 2: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 2: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 2: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 2: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 2: 
Chain 2:  Elapsed Time: 0.10839 seconds (Warm-up)
Chain 2:                2.40149 seconds (Sampling)
Chain 2:                2.50988 seconds (Total)
Chain 2: 

SAMPLING FOR MODEL 'continuous' NOW (CHAIN 3).
Chain 3: 
Chain 3: Gradient evaluation took 1.8e-05 seconds
Chain 3: 1000 transitions using 10 leapfrog steps per transition would take 0.18 seconds.
Chain 3: Adjust your expectations accordingly!
Chain 3: 
Chain 3: 
Chain 3: Iteration:    1 / 2000 [  0%]  (Warmup)
Chain 3: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 3: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 3: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 3: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 3: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 3: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 3: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 3: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 3: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 3: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 3: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 3: 
Chain 3:  Elapsed Time: 0.112294 seconds (Warm-up)
Chain 3:                2.38536 seconds (Sampling)
Chain 3:                2.49765 seconds (Total)
Chain 3: 

SAMPLING FOR MODEL 'continuous' NOW (CHAIN 4).
Chain 4: 
Chain 4: Gradient evaluation took 4.8e-05 seconds
Chain 4: 1000 transitions using 10 leapfrog steps per transition would take 0.48 seconds.
Chain 4: Adjust your expectations accordingly!
Chain 4: 
Chain 4: 
Chain 4: Iteration:    1 / 2000 [  0%]  (Warmup)
Chain 4: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 4: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 4: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 4: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 4: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 4: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 4: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 4: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 4: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 4: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 4: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 4: 
Chain 4:  Elapsed Time: 0.095678 seconds (Warm-up)
Chain 4:                2.41326 seconds (Sampling)
Chain 4:                2.50893 seconds (Total)
Chain 4: 

Model Info:
 function:     stan_glm
 family:       gaussian [identity]
 formula:      daily_deaths_per_mil ~ factor(closed) + factor(country) + retail_rec * 
       grocery_pharm
 algorithm:    sampling
 sample:       4000 (posterior sample size)
 priors:       see help('prior_summary')
 observations: 32567
 predictors:   6

Estimates:
                           mean   sd   10%   50%   90%
(Intercept)              -1.3    0.0 -1.3  -1.3  -1.3 
factor(closed)1           2.2    0.0  2.2   2.2   2.2 
factor(country)Sweden     2.1    0.0  2.1   2.1   2.1 
retail_rec                0.0    0.0  0.0   0.0   0.0 
grocery_pharm             0.0    0.0  0.0   0.0   0.0 
retail_rec:grocery_pharm  0.0    0.0  0.0   0.0   0.0 
sigma                     2.2    0.0  2.2   2.2   2.2 

Fit Diagnostics:
           mean   sd   10%   50%   90%
mean_PPD 1.9    0.0  1.8   1.9   1.9  

The mean_ppd is the sample average posterior predictive distribution of the outcome variable (for details see help('summary.stanreg')).

MCMC diagnostics
                         mcse Rhat n_eff
(Intercept)              0.0  1.0  3698 
factor(closed)1          0.0  1.0  3095 
factor(country)Sweden    0.0  1.0  3677 
retail_rec               0.0  1.0  3991 
grocery_pharm            0.0  1.0  3921 
retail_rec:grocery_pharm 0.0  1.0  5872 
sigma                    0.0  1.0  4002 
mean_PPD                 0.0  1.0  3580 
log-posterior            0.0  1.0  1769 

For each parameter, mcse is Monte Carlo standard error, n_eff is a crude measure of effective sample size, and Rhat is the potential scale reduction factor on split chains (at convergence Rhat=1).
                                    5%          95%
(Intercept)              -1.3542568393 -1.244430187
factor(closed)1           2.1420232793  2.249633044
factor(country)Sweden     2.0571374600  2.139704173
retail_rec               -0.0334232602 -0.031132991
grocery_pharm             0.0065696175  0.010545285
retail_rec:grocery_pharm  0.0001022717  0.000157699
sigma                     2.1832814781  2.211322124
summary(reg3)

Model Info:
 function:     stan_glm
 family:       gaussian [identity]
 formula:      daily_deaths_per_mil ~ factor(closed) + factor(country)
 algorithm:    sampling
 sample:       4000 (posterior sample size)
 priors:       see help('prior_summary')
 observations: 68976
 predictors:   3

Estimates:
                        mean   sd   10%   50%   90%
(Intercept)           -1.4    0.0 -1.5  -1.4  -1.4 
factor(closed)1        2.3    0.0  2.3   2.3   2.3 
factor(country)Sweden  2.1    0.0  2.1   2.1   2.1 
sigma                  2.4    0.0  2.4   2.4   2.4 

Fit Diagnostics:
           mean   sd   10%   50%   90%
mean_PPD 2.0    0.0  2.0   2.0   2.0  

The mean_ppd is the sample average posterior predictive distribution of the outcome variable (for details see help('summary.stanreg')).

MCMC diagnostics
                      mcse Rhat n_eff
(Intercept)           0.0  1.0  3986 
factor(closed)1       0.0  1.0  4276 
factor(country)Sweden 0.0  1.0  4624 
sigma                 0.0  1.0  5744 
mean_PPD              0.0  1.0  3253 
log-posterior         0.0  1.0  1875 

For each parameter, mcse is Monte Carlo standard error, n_eff is a crude measure of effective sample size, and Rhat is the potential scale reduction factor on split chains (at convergence Rhat=1).
summary(reg4)

Model Info:
 function:     stan_glm
 family:       gaussian [identity]
 formula:      daily_deaths_per_mil ~ factor(closed) + factor(country) + retail_rec * 
       grocery_pharm
 algorithm:    sampling
 sample:       4000 (posterior sample size)
 priors:       see help('prior_summary')
 observations: 32567
 predictors:   6

Estimates:
                           mean   sd   10%   50%   90%
(Intercept)              -1.3    0.0 -1.3  -1.3  -1.3 
factor(closed)1           2.2    0.0  2.2   2.2   2.2 
factor(country)Sweden     2.1    0.0  2.1   2.1   2.1 
retail_rec                0.0    0.0  0.0   0.0   0.0 
grocery_pharm             0.0    0.0  0.0   0.0   0.0 
retail_rec:grocery_pharm  0.0    0.0  0.0   0.0   0.0 
sigma                     2.2    0.0  2.2   2.2   2.2 

Fit Diagnostics:
           mean   sd   10%   50%   90%
mean_PPD 1.9    0.0  1.8   1.9   1.9  

The mean_ppd is the sample average posterior predictive distribution of the outcome variable (for details see help('summary.stanreg')).

MCMC diagnostics
                         mcse Rhat n_eff
(Intercept)              0.0  1.0  3698 
factor(closed)1          0.0  1.0  3095 
factor(country)Sweden    0.0  1.0  3677 
retail_rec               0.0  1.0  3991 
grocery_pharm            0.0  1.0  3921 
retail_rec:grocery_pharm 0.0  1.0  5872 
sigma                    0.0  1.0  4002 
mean_PPD                 0.0  1.0  3580 
log-posterior            0.0  1.0  1769 

For each parameter, mcse is Monte Carlo standard error, n_eff is a crude measure of effective sample size, and Rhat is the potential scale reduction factor on split chains (at convergence Rhat=1).
posterior_interval(reg4, prog = .9, type = 'central', pars = NULL, regex_pars = NULL)
                                    5%          95%
(Intercept)              -1.3542568393 -1.244430187
factor(closed)1           2.1420232793  2.249633044
factor(country)Sweden     2.0571374600  2.139704173
retail_rec               -0.0334232602 -0.031132991
grocery_pharm             0.0065696175  0.010545285
retail_rec:grocery_pharm  0.0001022717  0.000157699
sigma                     2.1832814781  2.211322124

There is an increase of about 2*** daily deaths per million after border closure. In Sweden alone, net of other measures, there was an increase of roughly 2 daily deaths per million. Net of country and other measures, restriction of mobility for retail/recreation and grocery/pharmacy establishments (interaction term) does not appear to decrease the daily deaths per million. These statistics are all significant at the 99.9$% confidence level. The overall model explains only 33% of the variance in the observed daily deaths per million.

Discussion and Next Steps

Our results confirm that irrespective of mobility curtailment and measures undertaken, from border closures to restaurant shutdowns, both countries’ health metrics eventually converged to comparable levels with marginal differences through time, while the difference was predominantly observed in diminished mobility and increased economic disruption. Next up, it would be prudent to examine data pertaining to the characteristics of the deceased and infected. Should additional data confirm what the reportage suggests, i.e. that the majority of the deaths occurred concomitant with underlying health issues, especially vis-a-vis higher age brackets, the rationale for mobility restrictions would face serious credibility problems.